<?php

namespace App\Library\Requests\ProductOrderReturn;

use App\Library\Requests\Base\BasePageRequest;
use App\Library\Rules\LikeRule;

class ProductOrderReturnPageRequest extends BasePageRequest
{
    public function rules(): array
    {
        return array_merge(parent::rules(), [
            'orType' => 'nullable|integer|in:1,2',
            'orReason' => 'nullable|integer|in:1,2',
            'orderId' => 'nullable|integer|min:1',
            'orBuyStatus' => 'nullable|integer|between:1,6',
            $this->No => 'nullable|string|size:20|regex:' . __('com.numReg'),
            'shopOrder.serialNumber' => 'nullable|string|size:20|regex:' . __('com.numReg'),
            'shopUser.userMobile' => 'nullable|string|size:11|regex:' . __('com.mobileReg'),
            'shopOrder.orderContactsMobile' => 'nullable|string|size:11|regex:' . __('com.mobileReg'),
            'shopOrderGoods.productId' => 'nullable|integer|min:1',
            'shopOrder.orderContacts' => ['nullable', 'string', 'max:30', new LikeRule],
            'expressNo' => ['nullable', 'string', 'max:30', new LikeRule],
            'startAt' => 'nullable|date|date_format:Y-m-d H:i:s',
            'endAt' => 'nullable|date|date_format:Y-m-d H:i:s',
        ]);
    }
}
